package com.lagou.rabbitmq.enums;

import lombok.Getter;

@Getter
public enum PayTypeEnum {

    ALIPAY(1, "支付宝"),
    WECHAT(2, "微信支付"),
    OTHER(3, "其他");

    private Integer code;
    private String name;

    PayTypeEnum(Integer code, String name) {
        this.code = code;
        this.name = name;
    }

    public static String getNameByCode(Integer code) {
        for (PayTypeEnum item : PayTypeEnum.values()) {
            if (item.getCode().equals(code)) {
                return item.getName();
            }
        }
        return null;
    }
}
